import { createStore } from 'redux'
// 1. 定义reducer函数
function reducer(state = { count: 10, msg: '213', xxx: 234 }, action) {
  switch (action.type) {
    case 'add':
      return {
        ...state,
        count: state.count + action.num,
      }
    default:
      return state
  }
}

// 2. 创建store对象
const store = createStore(reducer)

store.subscribe(() => {
  console.log('redux数据被修改了', store.getState())
})
export default store
